<template>
  <div class="position">
    <span class="iconfont position__icon">&#xe60e;</span>
    北京理工大学国防科技园2号楼10层北京理工大学国防科技园2号楼10层北京理工大学国防科技园2号楼10层北京理工大学国防科技园2号楼10层
    <span class="iconfont position__notice">&#xe71f;</span>
  </div>
  <router-link to="/search">
    <div class="search">
      <span class="iconfont">&#xe6e1;</span>
      山姆会员商店优惠商品
    </div>
  </router-link>
  <div class="banner">
    <img
      class="banner__img"
      src="http://www.dell-lee.com/imgs/vue3/banner.jpg"
      alt=""
    />
  </div>
  <div class="icons">
    <div class="icons__item" v-for="item in iconsList" :key="item.id">
      <img
        :src="`http://www.dell-lee.com/imgs/vue3/${item.imgName}.png`"
        alt=""
        class="icons__item__img"
      />
      <p class="icons__item__desc">{{ item.desc }}</p>
    </div>
  </div>
  <div class="gap"></div>
</template>

<script>
export default {
  setup() {
    const iconsList = [
      { imgName: '超市', desc: '超市便利' },
      { imgName: '红包', desc: '红包套餐' },
      { imgName: '大牌免运', desc: '大牌免运' },
      { imgName: '签到', desc: '签到' },
      { imgName: '蛋糕', desc: '烘焙蛋糕' },
      { imgName: '家居', desc: '家居时尚' },
      { imgName: '医药健康', desc: '医药健康' },
      { imgName: '鲜花', desc: '鲜花' },
      { imgName: '水果店', desc: '水果店' },
      { imgName: '菜市场', desc: '菜市场' },
    ];
    return { iconsList };
  },
};
</script>

<style lang="scss" scoped>
@import '@/style/viriables.scss';
@import '@/style/mixins.scss';

.position {
  position: relative;
  padding: 0.16rem 0;
  line-height: 0.22rem;
  font-size: 0.16rem;
  color: $content-fontcolor;
  @include ellipsis;
  padding: 0.16rem 0.24rem 0.16rem 0;
  &__icon {
    position: relative;
    top: 0.01rem;
    font-size: 0.2rem;
  }
  &__notice {
    position: absolute;
    right: 0;
    top: 0.17rem;
    font-size: 0.2rem;
  }
}
.search {
  margin-bottom: 0.12rem;
  line-height: 0.32rem;
  background-color: $search-bgColor;
  color: $search-fontColor;
  border-radius: 0.16rem;
  font-size: 0.14rem;
  .iconfont {
    // display: inline-block;
    font-size: 0.2rem;
    padding: 0 0.12rem 0 0.12rem;
  }
}
.banner {
  height: 0;
  overflow: hidden;
  padding-bottom: 25.4%; //防止图片未加载出来的时候下面的内容不展示
  &__img {
    width: 100%;
  }
}
.icons {
  display: flex;
  flex-wrap: wrap;
  margin-top: 0.16rem;
  &__item {
    width: 20%;
    &__img {
      display: block;
      width: 0.4rem;
      height: 0.4rem;
      margin: 0 auto;
    }
    &__desc {
      margin: 0.06rem 0 0.16rem 0;
      text-align: center;
      color: $content-fontcolor;
    }
  }
}
.gap {
  margin: 0 -0.18rem; //消去左右留白
  height: 0.1rem;
  background-color: $content-bgColor;
}
</style>
